<template>
  <div class="content" v-loading="noticeListLoading">
    <div class="active-content" v-loading="noticeListLoading">
      <!--    招聘会-->
      <div class="policy-position">
        <div class="block"></div>
        <div :class="fairActive===1?'router-link-active':''" @click="fairActive=1" class="title" style="font-family: 'fzhzgbjianti';">现场招聘会</div>
        <div :class="fairActive===2?'router-link-active':''" @click="fairActive=2" class="title" style="font-family: 'fzhzgbjianti';">网络招聘会</div>
        <div :class="fairActive===3?'router-link-active':''" @click="fairActive=3" class="title" style="font-family: 'fzhzgbjianti';">校园招聘会</div>
      </div>
    </div>
    <div class="fair">
      <div class="post-top">
        <div class="post" v-for="(item,index) in noticeList" :key="item.id">
          <div class="post-top1">
            <img src="../../assets/index/cover.png" alt="">
            <div class="ing" v-if="item.state==1">预定中</div>
            <div class="ing1" v-else-if="item.state==2">进行中</div>
            <div class="ing1" v-else-if="item.state==3">已结束</div>
            <div class="post-pay">
              <div class="title">
                {{ item.title }}
              </div>
              <div class="small-title">
                <div class="firm">职位：{{ item.zwCount }}</div>
                <div class="post1">企业：{{ item.qyCount }}</div>
              </div>
            </div>
          </div>
          <!--        <div class="site">{{ item.site }}</div>-->
          <div class="striping"></div>
          <div class="recruiter">
            <div class="time">{{ item.eventTimeStart }}-{{item.eventTimeEnd}}</div>
            <div class="message" @click="skip(item.id)">进入会场</div>
          </div>
        </div>
      </div>
    </div>
<!--    <div v-if="noticeList.length>0 && count>limit"  class="paging">-->
<!--      <el-pagination-->
<!--          background-->
<!--          :page-size="limit"-->
<!--          layout="prev, pager, next"-->
<!--          prev-text="上一页"-->
<!--          next-text="下一页"-->
<!--          :total="count"-->
<!--          @size-change="handleSizeChange"-->
<!--          @current-change="handleCurrentChange"-->
<!--          :current-page="this.page">-->
<!--      </el-pagination>-->
<!--      <div style="width: 110px;height: 1px"></div>-->
<!--    </div>-->
  </div>
</template>

<script>
import {getFairListApi} from "@/api/fair";

export default {
  name: "Fair",
  data(){
    return{
      count:0,
      limit:8,
      page:1,
      noticeListLoading:false,
      fairActive:1,
      noticeList:[]
    }
  },
  watch:{//监听
    fairActive:{
      handler(value){
        this.fairActive = value
        this.getList()
      }
    }
  },
  methods:{
    skip(id){
      this.$router.push({name: 'Activity',query:{id:id}})
    },
    getList() {
      this.noticeListLoading = true
      getFairListApi({page:this.page,limit:this.limit,sceneType:this.fairActive}).then((res) => {
        this.noticeList = res;
        this.count = res.length
      }).finally(()=>{
        this.noticeListLoading = false
      })
    },
    handleSizeChange(e) {
      this.limit = e
      this.getList()
    },
    handleCurrentChange(e) {
      this.page = e
      sessionStorage.setItem('currentPage',this.page)
      this.getList()
    },
  },
  mounted() {
    this.getList()
  }
}

</script>

<style lang="scss" scoped>
.content{
  width: 100%;
  .paging{
    width: 800px;
    margin: 30px auto;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    font-size: 20px;
    .el-pagination is-background{
      display: flex;
      text-decoration: none;
    }
  }
  .active-content{
    .policy-position{
      width: 800px;
      height: 70px;
      background-color: #fff;
      color: #989898;
      padding: 0 30px;
      border-radius: 20px;
      margin: 30px auto;
      display: flex;
      align-items: center;
      box-sizing: border-box;
      //padding: 0 1;
      .block{
        background-color: #498CF3;
        width: 10px;
        height: 37px;
        border-radius: 15px;
        margin-right: 15px;
      }
      .title,
      .title1,
      .title2
      {
        font-size: 25px;
        padding-top: 3px;
        //font-weight: 900;
        //padding-bottom: 3px;
        margin-right: 20px;
        //color: #797979;
        cursor: pointer;
      }
      .router-link-active {
        text-decoration: none;
        color: #4E8FF3;
      }
      a{
        text-decoration: none;
        color: #989898;
      }
    }
  }
  .post-top{
    display: flex;
    flex-wrap: wrap;
    width: 800px;
    margin: 0 auto;
   // justify-content: space-between;
    .post{
      padding: 20px 18px;
      background-color: #fff;
      border-radius: 15px;
      width: calc((100% - 45px) /2);
      margin: 20px 10px;
      .post-top1{
        position: relative;
        box-sizing: border-box;
        display: flex;
        height: 188px;
        .ing{
          position: absolute;
          top: 10px;
          left: 10px;
          border-radius: 10px;
          background-color: #498CF3;
          width: 50px;
          height: 20px;
          font-size: 10px;
          text-align: center;
          line-height: 20px;
          color: #fff;
        }
        .ing1{
          position: absolute;
          top: 10px;
          left: 10px;
          border-radius: 10px;
          background-color: #989898;
          width: 50px;
          height: 20px;
          font-size: 10px;
          text-align: center;
          line-height: 20px;
          color: #fff;
        }
        img{
          width: 120px;
          height: 120px;
        }
        .post-pay{
          margin-left: 15px;
          font-size: 26px;
          color: #5493F3;
          .title{
            line-height: 30px;
            font-weight: 800;
            font-size: 20px;
            color: #3F3F3F;
          }
          .small-title{
            display: flex;
            line-height: 60px;
            font-size: 20px;
            color: #919191;
            .firm{
              margin-right: 30px;
            }
          }
        }
      }
      .striping{
        margin-top: 20px;
        width: 100%;
        height: 2px;
        background-color: #D8D8D8;
      }
      .recruiter{
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 20px;
        font-size: 18px;
        .time{

        }
        .message{
          width: 100px;
          height: 40px;
          //background-color: #fff;
          border: 1px solid #649DF4;
          color: #649DF4;
          border-radius: 20px;
          text-align: center;
          line-height: 40px;
        }
      }
    }
  }
}
</style>
